package com.example.jdcompetition.Service.cvsPro.time;

import java.util.Objects;

/**
 * @author henrydai
 * @date 2021/6/7 9:57
 */
public class TransitTime implements Comparable{
    public long transitTime ;   //派送时长加时
    public long effectiveDate;  //生效日期
    public long expirationDate; //失效日期
    public TransitTime(long transitTime,long effectiveDate,long expirationDate)
    {
        this.transitTime=transitTime;
        this.effectiveDate=effectiveDate;
        this.expirationDate=expirationDate;
    }

    @Override
    public String toString() {
        return "TransitTime{" +
                "transitTime=" + transitTime +
                ", effectiveDate=" + effectiveDate +
                ", expirationDate=" + expirationDate +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TransitTime that = (TransitTime) o;
        return transitTime == that.transitTime && effectiveDate == that.effectiveDate && expirationDate == that.expirationDate;
    }

    @Override
    public int hashCode() {
        return Objects.hash(transitTime, effectiveDate, expirationDate);
    }

    @Override
    public int compareTo(Object o) {
        TransitTime other = (TransitTime) o;
        if(this.effectiveDate> other.effectiveDate)
        {
            return 1;
        }
        else
        {
            return -1;
        }
    }
}
